package com.itheima11;

/**
 * @author Xiao
 * @date 2021/7/20
 */
public class FactorialDemo {
    /**
     * 递归
     */
    public static void main(String[] args) {
        int sum = getSum(100);
        System.out.println(sum);
    }

    private static int getSum(int i) {
        if (i == 1) {
            return 1;
        }else {
            return i + getSum(i-1);

        }
    }
}
